<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="com.pignest.hotel.spring.Services"%>
<%@page import="com.pignest.hotel.service.ReceptionService"%>
<%@page import="com.pignest.hotel.service.MemberService"%>
<%@page import="com.pignest.hotel.beans.Member" %>
<%@page import="com.pignest.hotel.beans.Living" %>
<%@page import="com.pignest.hotel.util.UIUtils" %>
<%@page import="com.pignest.hotel.definition.OpenRoomType" %>
<%
String card = request.getParameter("card");
String livingId=null;
String openType=null;
if (StringUtils.isEmpty(card)) {	// || card not exists
%>
<jsp:forward page="index.jsp"></jsp:forward>
<%
}else {
	MemberService ms =Services.getMemberService();
	String cardNumber =ms.queryCardNoBySerial(card);
	Member m=ms.queryMemberOnCard(cardNumber);
	
	if(m==null)
	{
		out.print("<script type=\"text/javascript\">alert('无效会员请联系请台管理员！', null);</script>");
		out.print("<script type=\"text/javascript\">window.location.href='index.jsp';</script>");
	}else{
		ReceptionService rs=Services.getReceptionService();
		Living l =rs.getSelfMemberLiving(m);
		if(l==null)
		{
			out.print("<script type=\"text/javascript\">alert('当前没有入住信息！', null);</script>");
		    out.print("<script type=\"text/javascript\">window.location.href='index.jsp';</script>");
		}else
		{
			livingId=l.getId();
			openType=l.getOpenRoomType();
		}
	}
	  request.setAttribute("index", 1);
	
%>
<jsp:include page="frame.jsp" ></jsp:include>
<div id="selfhelpContent">
<%
 if(OpenRoomType.valueOf(openType).name().equals(OpenRoomType.HOURS.name())){
	 System.out.println(openType);
%>
<iframe width="100%" height="100%" frameborder="0" scrolling="no" src="hoursbackRoom.zul?livingId=<%=livingId%>"></iframe>
<%}else if(OpenRoomType.valueOf(openType).name().equals(OpenRoomType.HALFDAY.name())) {%>
<iframe width="100%" height="100%" frameborder="0" scrolling="no" src="halfbackRoom.zul?livingId=<%=livingId%>"></iframe>
<%}else { %>
<iframe width="100%" height="100%" frameborder="0" scrolling="no" src="backRoom.zul?livingId=<%=livingId%>"></iframe>
<%} %>
</div>
<%
}
%>
